<template>
  <el-carousel :interval="5000" arrow="always">
    <el-carousel-item v-for="(banner, index) in banners" :key="index">
      <img :src="banner.img" alt="" class="bannerpic" />
      <div class="bname">{{ banner.bname }}</div>
    </el-carousel-item>
  </el-carousel>
</template>
<script>
export default {
  data() {
    return {
      banners: [],
    };
  },
  mounted() {
    this.axios.get("/index/banner").then((result) => {
      this.banners = result.data;
      // console.log(result.data);
      // console.log(this.banners);
    });
  },
};
</script>
<style>
.el-carousel__item h3 {
  color: #475669;
  font-size: 18px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.el-carousel__container {
  position: relative;
  height: 600px !important;
}
.el-carousel__button {
  height: 10px !important;
  border-radius: 4px;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
}
.bannerpic {
  height: 600px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.bname {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: Raleway;
  font-size: 40px;
  font-weight: normal;
  font-style: normal;
  color: #000000;
  transform: translate(-50%, -50%);
}
</style>